using UnityEngine;
using System.Collections;

public class Door : MonoBehaviour 
{
	private bool DisplayText;
	
	// Use this for initialization
	void Start () 
	{
		DisplayText = false;
		
	}
	
	// Update is called once per frame
	void Update () 
	{
	}
	
	void OnTriggerEnter(Collider other)
	{
		Debug.Log("trigger collision " + other.gameObject.name);
		DisplayText = true;
		
		GameObject goFireworks = transform.Find("LeftDoor").Find("Fireworks").gameObject;
		goFireworks.particleSystem.Play();
		
		goFireworks = transform.Find("RightDoor").Find("Fireworks").gameObject;
		goFireworks.particleSystem.Play();
	}
	void OnGUI()
	{
		if(DisplayText)
    		GUI.Label(new Rect(Screen.width/2,Screen.height/2,Screen.width/2,Screen.height/2),"You Win!!");
	}
}
